package cn.z2huo.demo.activiti.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * <p>activiti 配置类
 * <p>其实这个类中的 bean 都可以不用自己复制注入，spring 都帮我们做了
 *
 * @see org.activiti.spring.boot.ProcessEngineAutoConfiguration
 * @see org.activiti.spring.boot.AbstractProcessEngineConfiguration
 */
@Slf4j
@Configuration
public class ActivitiConfig {

//    @Autowired
//    private PlatformTransactionManager transactionManager;
//
//    @Autowired
//    private DataSource dataSource;

//    @Bean
//    public SpringProcessEngineConfiguration processEngineConfiguration() throws IOException {
//        SpringProcessEngineConfiguration springProcessEngineConfiguration = new SpringProcessEngineConfiguration();
//        springProcessEngineConfiguration.setDataSource(dataSource);
//        springProcessEngineConfiguration.setTransactionManager(transactionManager);
////        springProcessEngineConfiguration.setDatabaseType("postgresql");
//        // 表处理策略，默认为false
//        // true
//        // false
//        // create-drop
//        springProcessEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
////        Resource[] resources = new PathMatchingResourcePatternResolver()
////                .getResources(ResourceLoader.CLASSPATH_URL_PREFIX + "/process/*.bpmn20.xml");
////        springProcessEngineConfiguration.setDeploymentResources(resources);
//
//        return springProcessEngineConfiguration;
//    }

//    @Bean
//    public ProcessEngineFactoryBean processEngine(SpringProcessEngineConfiguration processEngineConfiguration) {
//        ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
//        processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
//        return processEngineFactoryBean;
//    }
//
//    @Bean
//    public RuntimeService runtimeService(ProcessEngine processEngine) {
//        return processEngine.getRuntimeService();
//    }
//
//    @Bean
//    public TaskService taskService(ProcessEngine processEngine) {
//        return processEngine.getTaskService();
//    }
//
//    @Bean
//    public RepositoryService repositoryService(ProcessEngine processEngine) {
//        return processEngine.getRepositoryService();
//    }
//
//    @Bean
//    public HistoryService historyService(ProcessEngine processEngine) {
//        return processEngine.getHistoryService();
//    }

}
